package com.atguigu.spzx.manager.controller;


import com.atguigu.spzx.manager.sevice.SysUserService;
import com.atguigu.spzx.model.dto.system.LoginDto;
import com.atguigu.spzx.model.vo.common.Result;
import com.atguigu.spzx.model.vo.common.ResultCodeEnum;
import com.atguigu.spzx.model.vo.system.LoginVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Tag(name = "用户登录模块")
@RestController
@RequestMapping("/admin")
public class IndexController {


    @Autowired
   private   SysUserService sysUserService;


    @PostMapping("login")
    @Operation(summary = "用户登录")
        public Result login (@RequestBody LoginDto loginDto){
LoginVo loginVo =  sysUserService.login(loginDto);

        return Result.build(loginVo, ResultCodeEnum.SUCCESS);
    }



}
